<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 1.字符串
        var str="welcome";
        let [a,b,c,d,e,f,g]=str;
        console.log(a,b,c,d,e,f,g);
        let [...arr]=str;
        console.log(arr);

        // 2.数值等基本数据类型的解构
        // a.等于号右边的基本数据类型会自动转换为引用数据类型(对象)
        // b.解构转换为对象中的原型方法
        var num=123;//基本数据类型
        // var num=new Number(123);//引用数据类型
        console.log(num);
        let {toFixed}=num;
        console.log(toFixed);


        var obj={
            status:true,
            msg:"嘻嘻",
            result:{
                type:"衣服",
                list:["上衣","鞋子","T恤","衬衫","裤子"]
            }
        };

        function show(objs){//形参
            if(objs.status){
                console.log("类型:"+objs.result.type);
                for(var i=0;i<objs.result.list.length;i++){
                    console.log(objs.result.list[i]);
                }
            }
        }
        show(obj);//obj是实参
        console.log("----------------------");
        function show2({status,result}){
            if(status){
                let {type,list}=result;
                console.log("类型:"+type);
                for(var i=0;i<list.length;i++){
                    console.log(list[i]);
                }
            }
        }
        show2(obj);
        console.log("----------------------");
        function show3({status,result:{type,list}}){
            if(status){
                console.log("类型:"+type);
                for(var i=0;i<list.length;i++){
                    console.log(list[i]);
                }
            }
        }
        show3(obj);
        console.log("----------------------");
        console.log(Math.ceil(10.2));//11
        console.log(Math.floor(9.9));//9

        console.log(Math);

        let {ceil,floor,round}=Math;
        console.log(ceil(100.2));//101
        console.log(floor(90.9));//90
        console.log(round(7.6));//8

    </script>
</head>
<body>
    
</body>
</html>